<div class="layui-card">
    <div class="layui-card-body">
        <form class="layui-form layui-form-pane">
            <div class="layui-form-item">
                <label class="layui-form-label">昵称</label>
                <div class="layui-input-block">
                    <input type="text" name="nickname" class="layui-input" value="{$find.nickname}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">头像</label>
                <div class="layui-input-group">
                    <input type="text" name="avatar" autocomplete="off" placeholder="请输入头像" lay-verify="required"
                        class="layui-input" value="{$find.avatar}">
                    <div class="layui-input-suffix">
                        <img src="{$find.avatar}" data-title="头像" class="image" />
                    </div>
                    <div class="layui-input-suffix uploads">
                        <a href="javascript:;" class="layui-btn ">
                            <i class="layui-icon layui-icon-upload"></i>上传
                        </a>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">角色</label>
                <div class="layui-input-block">
                    <div id="rid" name="rid" value="0"></div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">用户</label>
                <div class="layui-input-block">
                    <input type="text" name="username" class="layui-input" value="{$find.username}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-block">
                    <input type="password" lay-affix="eye" name="password" class="layui-input" placeholder="不修改请留空">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="layui-input-block">
                    <input type="text" name="email" class="layui-input" value="{$find.email}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">手机</label>
                <div class="layui-input-block">
                    <input type="text" name="mobile" class="layui-input" value="{$find.mobile}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-block">
                    <select name="status">
                        <option value="0" {$find.status=='0' ? 'selected' : '' }>正常</option>
                        <option value="1" {$find.status=='1' ? 'selected' : '' }>禁用</option>
                    </select>
                </div>
            </div>
        </form>
    </div>
</div>
<script>
    layui.use(["jquery", "xmSelect", "form", "common"], function () {

        // 父级
        layui.$.post("{:route('admin.adminRoles.query')}", { limit: 1000 }, function (res) {
            layui.xmSelect.render({
                el: "#rid",
                name: "rid",
                initValue: [`{$find.rid}`],
                tips: "无",
                toolbar: { show: true, list: ["CLEAR"] },
                data: res.data,
                model: { "icon": "hidden", "label": { "type": "text" } },
                clickClose: true,
                radio: true,
                tree: { show: true, "strict": false, "clickCheck": true, "clickExpand": false, expandedKeys: [`{$find.rid}`] },
                prop: {
                    value: "id"
                }
            });
        })

        // 查看文件
        layui.common.openFiles(".image");
        // 附件上传
        layui.$(".uploads").on("click", function () {
            layui.common.openAssets(this, `{:route('admin.attachment.query')}`);
        })

    })
</script>